///////////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 2007-2009 ILOG, S.A.
//  All Rights Reserved.
//  The following is ILOG Source Code.  No modifications may be made to the  
//  ILOG Source Code.  Any usage of the ILOG Source Code is subject to 
//  the terms and conditions of the ILOG End User License Agreement   
//  applicable to this ILOG software product.
//
///////////////////////////////////////////////////////////////////////////////

package ilog.gauges.gaugesClasses
{
  import flash.events.Event;

  /**
   * The <code>NumericScale</code> class acts as a common base class
   * for scale types representing a continuous range of values
   * between a defined minimum and a defined maximum.
   * The built-in <code>LinearScale</code> and <code>LogScale</code> subclasses
   * extend this base class.
   * 
   * You typically do not use the <code>NumericScale</code> class directly.
   * Instead, you use one of its subclasses, like <code>CircularLinearScale</code>
   * or <code>RectangularCategoryScale</code>.
   * 
   * @mxml
   *  
   * <p>The <code>&lt;mx:NumericScale&gt;</code> tag inherits all the properties
   * of its parent classes and adds the following properties:</p>
   *  
   * <pre>
   * &lt;mx:NumericScale
   *   <strong>Properties</strong>
   *   minimum="0"
   *   maximum="100"
   * /&gt;
   * </pre>
   *
   * @see ilog.gauges.circular.CircularLinearScale
   * @see ilog.gauges.circular.CircularLogScale
   * @see ilog.gauges.rectangular.RectangularLinearScale
   * @see ilog.gauges.rectangular.RectangularLogScale
   * 
   */
  public class NumericScale extends ScaleBase
  {
    /**
     * Constructor.
     */
    public function NumericScale()
    {
      super();
    }

    /**
     * @private
     */
    private var _maximum:Number = 100;

    [Bindable("maximumChanged")]
    [Inspectable(category="Gauge")]
     
    /**
     * The maximum value of the scale. Must be greater than the start value.
     * 
     * @default 100 
     */
    public function get maximum():Number
    {
      return _maximum;
    }

    /**
     * @private
     */
    public function set maximum(value:Number):void
    {
      if (_maximum == value)
        return;
      _maximum = value;
      invalidateTicks();
      dispatchEvent(new Event("maximumChanged"));
    }

    /**
     * @private
     */
    private var _minimum:Number = 0;

    [Bindable("minimumChanged")]
    [Inspectable(category="Gauge")] 
    
    /**
     * The minimum value of the scale. Must be smaller than the maximum value.
     * 
     * @default 0
     */
    public function get minimum():Number
    {
      return _minimum;
    }

    /**
     * @private
     */
    public function set minimum(value:Number):void
    {
      if (_minimum == value)
        return;
      _minimum = value;
      invalidateTicks();
      dispatchEvent(new Event("minimumChanged"));
    }
  }
}
